package com.xfhy.wallpaperdemo;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.xfhy.wallpaperdemo.lock.LockScreenReceiver;
import com.xfhy.wallpaperdemo.lock.NotifyService;
import com.xfhy.wallpaperdemo.lock.NotifyUtil;
import com.xfhy.wallpaperdemo.test.SecondActivity;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.btn_start).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                WallPaperUtils.gotoSetWallPaper(MainActivity.this);
            }
        });


        //NotifyUtil.getPermanentNotification();
        //NotifyUtil.showPermanentNotification();


        findViewById(R.id.btn_init_notify).setOnClickListener(new View.OnClickListener() {
            @SuppressLint("WrongConstant")
            @Override
            public void onClick(View v) {

                /*try {
                    long startTime = System.currentTimeMillis();
                    PackageManager packageManager = MyApplication.sContext.getPackageManager();
                    String packageName = MyApplication.sContext.getPackageName();
                    ApplicationInfo applicationInfo = packageManager.getApplicationInfo(packageName, 128);
                    if ((applicationInfo.flags & 2097152) != 0) {
                        Log.d("xfhy_test", "进入if");
                    }
                    Log.d("xfhy_test", "耗时: " + (System.currentTimeMillis() - startTime));
                } catch (PackageManager.NameNotFoundException e) {
                    e.printStackTrace();
                }*/
                startActivity(new Intent(MainActivity.this, SecondActivity.class));

            }
        });
    }

}